package Generics;

public class Test1 {
    public static void main(String[] args) {
        MyArray<Integer> myArray = new MyArray<Integer>();

        for (int i = 0; i < myArray.array.length; i++) {
            myArray.setArray(i, i);
        }

        System.out.println(myArray.getArray(3));

//        myArray.setArray(0, "123");
    }
}

class MyArray <T> {
    public Object[] array = new Object[10];

    public void setArray(int pos, T value) {
        this.array[pos] = value;
    }

    public T getArray(int pos) {
        return (T)array[pos];
    }
}